chore: bump stellar SDK to 16.0.1#148
Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
All alerts resolved. Learn more about Socket for GitHub. This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored. Ignoring alerts on:
|
|
@SocketSecurity ignore npm/@stellar/stellar-sdk@16.0.1 Reviewed as acceptable risk for this PR. Reasoning:
|
There was a problem hiding this comment.
Pull request overview
Updates the Snap to be compatible with @stellar/stellar-sdk v16 by upgrading the dependency and adjusting transaction typing, simulation helpers, and network access to work reliably in the SES Snap runtime (using Snap-controlled fetch instead of SDK server clients).
Changes:
- Bumped
@stellar/stellar-sdkto^16.0.1and raised the repo Node engine requirement to>= 22. - Updated transaction parsing/simulation code to align with SDK v16 types (
OperationRecord, optional fields, revoke sponsorship split). - Introduced Snap-safe
HorizonClient/SorobanRpcClientand refactoredNetworkService/MultiCallto use them; adjusted Jest transforms for ESM dependencies.
Reviewed changes
Copilot reviewed 24 out of 25 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| yarn.lock | Updates lockfile for Stellar SDK v16 and related dependency graph changes. |
| packages/snap/src/utils/caip.ts | Adds issuer guards for classic asset CAIP conversion with updated SDK typing. |
| packages/snap/src/services/transaction/xdrParser.ts | Adjusts imports and adds issuer undefined handling in CAIP conversion. |
| packages/snap/src/services/transaction/utils.ts | Switches operation helpers to accept OperationRecord and refines type guards. |
| packages/snap/src/services/transaction/TransactionSimulator.ts | Updates simulator internals to operate on OperationRecord[]. |
| packages/snap/src/services/transaction/TransactionSimulator.test.ts | Updates tests/fixtures usage for OperationRecord typing. |
| packages/snap/src/services/transaction/TransactionBuilder.ts | Updates changeTrust operation typing to match v16 API surface. |
| packages/snap/src/services/transaction/Transaction.ts | Updates transactionOperations to return OperationRecord[]. |
| packages/snap/src/services/transaction/simulation/utils.ts | Updates simulation helpers to use OperationRecord. |
| packages/snap/src/services/transaction/simulation/simulators.ts | Refactors simulator op typing and adds issuer guards for trustlines. |
| packages/snap/src/services/transaction/simulation/api.ts | Updates simulation API types to accept OperationRecord and readonly lists. |
| packages/snap/src/services/transaction/OperationMapper.ts | Updates mapper to consume OperationRecord, handles optional decoded fields, and supports new revoke sponsorship variants. |
| packages/snap/src/services/transaction/api.ts | Extends operation type enum for SDK v16 revoke sponsorship split. |
| packages/snap/src/services/network/utils.ts | Switches account-not-found detection to Snap Horizon client error type. |
| packages/snap/src/services/network/SorobanRpcClient.ts | Adds Snap-safe JSON-RPC Soroban client built on fetch with XDR parsing helpers. |
| packages/snap/src/services/network/SorobanRpcClient.test.ts | Adds unit tests for the Soroban RPC client fetch wiring and error mapping. |
| packages/snap/src/services/network/NetworkService.ts | Refactors to use HorizonClient / SorobanRpcClient instead of SDK server clients. |
| packages/snap/src/services/network/NetworkService.test.ts | Updates tests to spy/match new client methods and error types. |
| packages/snap/src/services/network/MultiCall.ts | Depends on a minimal simulateTransaction interface and adjusts simulation error handling. |
| packages/snap/src/services/network/HorizonClient.ts | Adds Snap-safe Horizon REST client built on fetch (pagination, assets, transactions, base fee). |
| packages/snap/src/services/network/HorizonClient.test.ts | Adds unit tests for Horizon client base fee, account helper mapping, and 404 behavior. |
| packages/snap/snap.manifest.json | Updates bundle shasum to match the rebuilt Snap artifact. |
| packages/snap/package.json | Bumps @stellar/stellar-sdk dependency to v16. |
| packages/snap/jest.config.js | Updates Jest transforms/ignore patterns to handle ESM dependencies needed by SDK v16. |
| package.json | Raises Node engine requirement to >= 22. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Explanation
Summary
Bumps
@stellar/stellar-sdkfrom^15.0.1to^16.0.1and applies the small compatibility changes needed for the Snap runtime and tests.Changes
@stellar/stellar-sdkto^16.0.1.>=22.ts-jestnow allows JS transforms.OperationRecordfor decoded transaction operations.Operation.*types where specific operation shapes are needed.Asset.getIssuer().changeTrustoperation construction typing to follow the v16 API.HorizonClientfor the Horizon endpoints this Snap uses.SorobanRpcClientfor the Soroban JSON-RPC methods this Snap uses.NetworkServiceto use those clients instead of SDKHorizon.Server/rpc.Server.MultiCallto depend on a smallsimulateTransactioninterface instead ofrpc.Server.eventsourceshim and webpack alias. The Snap bundle now builds without that workaround.Why the custom Horizon/RPC clients were added
The Snap runs in SES and does not have the same globals as a browser or Node runtime. SDK v16’s server clients use their own transport layer, which can rely on globals such as
URLSearchParams,Blob,AbortController, and EventSource-related code paths.This PR moves only the network transport layer into small Snap-controlled clients that use the Snap
fetchendowment directly.The SDK is still used for Stellar primitives such as transactions, XDR, assets, accounts, contracts, addresses, and Soroban parsing/assembly data structures.
Why the Jest config changed
SDK v16 and some of its dependencies are ESM-first packages distributed through
node_modules. Jest was previously ignoringnode_modulestransforms, which caused tests to fail when loading these packages.The Jest config now:
ts-jestwithallowJs: trueso JavaScript files from selected ESM dependencies can be transformed.@stellar/stellar-sdk@noble/ed25519@noble/hashesuint8array-extrasThis keeps the transform scope narrow instead of transpiling all of
node_modules.References
Checklist